Skip to content

fix: "No chat model selected" error on startup#11672

Merged
RomneyDa merged 3 commits intomainfrom
dallin/no-model-selected-issue
Mar 24, 2026
Merged

fix: "No chat model selected" error on startup#11672
RomneyDa merged 3 commits intomainfrom
dallin/no-model-selected-issue

Conversation

@RomneyDa
Copy link
Collaborator

@RomneyDa RomneyDa commented Mar 21, 2026

Race condition during initialization: loadConfig() checked this.currentProfile before await this.isInitialized, returning config: undefined before the profile was set. The GUI then applied EMPTY_CONFIG with selectedModelByRole.chat: null.

  • Reorder loadConfig() to await init before checking profile (matches getSerializedConfig())
  • Guard against !configResult.config in GUI's handleConfigUpdate

Fixes #11636
Fixes #11656
Fixes #11661
Fixes #11591
Fixes #11627
Fixes #11605
Fixes #11614
Fixes #11572
Fixes #11512
Fixes #11533
Fixes #11520
Fixes #11515
Fixes #11514

Three fixes for the model selection bugs reported in #11656 and 12+ related issues:

1. Fix loadConfig() init ordering: await isInitialized before checking
   currentProfile, consistent with getSerializedConfig(). Prevents
   returning config: undefined during initialization race.

2. Avoid full config reload on model selection: The config/updateSelectedModel
   handler now updates the model in the cached config in-place instead of
   doing a full reloadConfig(). This eliminates the window where
   selectedModelByRole.chat is null during reload, and prevents the
   configUpdate from core overwriting the GUI's optimistic selection.

3. Guard against undefined config in GUI: handleConfigUpdate now also
   checks !configResult.config alongside configLoadInterrupted, preventing
   EMPTY_CONFIG (with chat: null) from being applied.
Two fixes for the "No chat model selected" error reported in #11656 and
12+ related issues across all providers:

1. Fix loadConfig() init ordering (ConfigHandler.ts): Move
   `await this.isInitialized` before the `!this.currentProfile` check,
   matching the pattern already used in getSerializedConfig(). Without
   this, loadConfig() called during initialization returns
   config: undefined because currentProfile hasn't been set yet.

2. Guard against undefined config in GUI (ParallelListeners.tsx):
   handleConfigUpdate now also checks `!configResult.config` alongside
   configLoadInterrupted, preventing EMPTY_CONFIG (with
   selectedModelByRole.chat: null) from being applied.
@RomneyDa RomneyDa changed the title fix: resolve "No chat model selected" error and GUI/core model mismatch fix: "No chat model selected" error on startup Mar 21, 2026
@RomneyDa RomneyDa marked this pull request as ready for review March 21, 2026 01:08
@RomneyDa RomneyDa requested a review from a team as a code owner March 21, 2026 01:08
@RomneyDa RomneyDa requested review from sestinj and removed request for a team March 21, 2026 01:08
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 21, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Mar 24, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 24, 2026
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Mar 24, 2026
The added `!configResult.config` guard in ParallelListeners caused tests
to bail early since MockIdeMessenger returned `config: undefined`.
@RomneyDa RomneyDa merged commit 92c4d19 into main Mar 24, 2026
64 of 65 checks passed
@RomneyDa RomneyDa deleted the dallin/no-model-selected-issue branch March 24, 2026 20:05
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Mar 24, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Done

2 participants